If there's one rule in golf which should be changed, it would be the one which makes a player have to hit out of another inconsiderate player's divot. So some yahoo doesn't replace his divot and I have to be penalized for it? Until that rule changes, which it never will, we will need a technique for hitting out of divots.
First, take a bit of a narrower stance than normal. Put the ball in the center of the stance, or if you are comfortable you can even put the ball back toward the right foot a little (right handed golfers). The weight will be mostly on the front (left) foot.
To get the ball out of the divot, we need a steeply descending blow from an iron. We do NOT want the club coming in low, or we will be hitting the top of the ball and possibly driving the ball deeper into the ground. To make that descending blow, take a steeper takeaway, bringing the club up faster. Bring the club back down the same steep path, aiming the blade right at the back/center of the ball. We want the club to enter the divot as close to the ball as possible. The club should stay low through impact. Finish low, like hitting a punch shot in the wind.
The ball will exit the divot with this setup and swing fairly easily, but will come out low. The ball may be hot and have not a lot of spin, so consider that the proper club may be more lofted than a club you'd regularly hit that distance.
Next time you are at the practice range, find an area with a bunch of divots rather than the best piece of grass you'd normally look for. Throw balls in all the divots you can find and practice the setup and swing. Then when the situation happens on the course, you can confidently step up to the ball and execute the shot.