Check the Grain
Bunkers come in a variety of sand conditions--some good, some not so good. When you find yourself swallowed up, the first thing you want to do is assess the grit and size of the sand grain. If the sand is clumpy and heavy, that's going to make things tougher on you and you're going to need to put a little more on your shot to get it out. If the sand is light and nonsticky, you'll have an easier time of getting out--providing your ball's not buried.
Once you've surveyed the bunker and the sand grain, you're ready to position yourself for the shot. Approach the ball. Because you'll most likely be using a wedge you'll want to be up tight on the ball, so shorten the distance between your body and where your ball sits (not much, you still want to be comfortable). You'll also want to position your feet a little further apart than normal. If you generally have your feet at shoulder width, give them an extra inch on either side. This will give you more stability. Once you've done these two things, you want to plant yourself in to the sand so that your feet don't move when you swing. To do this, simply swivel your hips until you feel your feet digging down into the sand. Stop when you feel like you're firm in the trap.
Blast It or Pick It
There are two ways to get out of the trap; blast it or pick it. Which one you choose depends on the distance to the pin, the slope of the green and the grain of the sand. If the sand is heavy and clumped, you'll want to blast it--digging your club in on the downswing, taking lots of sand and allowing the force of the swing to carry the ball out of the bunker. If the sand is dry and light, the ball is sitting up on the sand and you have a relatively flat green, you'll want to pick the ball while trying to catch as little of the sand as possible, thus picking the ball out of the trap.