You can take practice swings but you can't make contact with the surface. I often take practice swings "above" the ball where I look to see where I'd like to make contact behind the ball and check the angle of my swing.
I usually don't take so much of a "practice swing" as just waggle a little bit, paying more attention to the surface of the sand and the lie than the swing itself. I usually get up there, figure out if I need to hit it thinner or can "blast" it a little more, pick the spot behind the ball I want to hit into the sand at, and hack away. Surprisingly, I'm a pretty good bunker player.
Here's a good practice-swing tip. Since you can't ground your club in the bunker, before you enter the hazard, take a sand swing in some deep rough. When you follow through, take some grass (if it is an explosion shot) or take hardly any at all (if you want to pick it clean).
This takes me back to the first time I ever played golf. I'll admit I never knew a lot of ettiquette. I shot a 128 but I'll never forget when I got into a sand trap, I took about 6 practice swings in there because I had no idea what to do. Anyway, I had to learn the hard way (my friend told me after) that you can't ground the club in the sand trap.