It's a recurring horror in sci-fi: the hull is pierced, a human is trapped without equipment in an airlock about to open, a door needs to be opened in order to expel something undesirable. With no air and almost zero pressure, the human body isn't going to last long without some form of protection.
But what does happen, exactly? Do your eyes explode outward while your blood evaporates? Well, no. The truth is both less dramatic and far more fascinating -- as we have discovered through accidents in space and in test chambers, and animal experimentation in the 1960s.
The first thing you would notice is the lack of air. You wouldn't lose consciousness straight away; it might take up to 15 seconds as your body uses up the remaining oxygen reserves from your bloodstream, and -- if you don't hold your breath -- you could perhaps survive for as long as two minutes without permanent injury.
If you do hold your breath, the loss of external pressure would cause the gas inside your lungs to expand, which will rupture the lungs and release air into the circulatory system. The first thing to do if you ever find yourself suddenly expelled into the vacuum of space is exhale.
The other things, you can't really do much about. After about 10 seconds or so, your skin and the tissue underneath will begin to swell as the water in your body starts to vaporise in the absence of atmospheric pressure. You won't balloon to the point of exploding, though, since human skin is strong enough to keep from bursting; and, if you're brought back to atmospheric pressure, your skin and tissue will return to normal.
It also won't affect your blood, since your circulatory system is able to keep your blood pressure regulated, unless you go into shock. The moisture on your tongue may begin to boil, though, as reported by Jim LeBlanc, who was exposed to near vacuum in a test chamber in 1965. LeBlanc's suit sprung a leak, and he remained conscious for about 14 seconds; his last sensation was bubbling on his tongue (he was safely revived, as the researchers began repressurising the chamber almost immediately -- after about 15 seconds).
Because you will be exposed to unfiltered cosmic radiation, you can expect some nasty sunburn, and you'll probably also get a case of decompression sickness.You would not, however, freeze straight away, despite the extremely cold temperatures; heat does not leave the body quickly enough for you to freeze before you suffocate, due to the lack of both convection and conduction.
If you do die in space, your body will not decompose in the normal way, since there is no oxygen. If you were near a source of heat, your body would mummify; if you were not, it would freeze. If your body was sealed in a space suit, it would decompose, but only for as long as the oxygen lasted. Whichever the condition, though, your body would last for a very, very long time without air to facilitate weathering and degradation. Your corpse could drift in the vast expanse of space for millions of years.