The only thing "soundproof foam" is good for is burning down the building and killing everyone in it. There is no such thing as "soundproof foam."
There are basically two ways airborne sound travels between two rooms: 1) air leaks between the rooms. 2) through a mechanism where the sound wiggles the wall surface on one side, which wiggles the surface on the other side and re-transmits the sound back into the air.
You can stop air leaks with attention to detail during construction - the partitions should go all the way up to the ceiling, and the floor and ceiling joints should be caulked. The only way to stop the second problem is making the wall more difficult to wiggle - or increasing it's mass. Most modern dormitories have moved away from concrete and concrete block construction which is much better at stopping sound to a gypsum wall board on metal stud construction, which is lighter and therefore transmits sound much better.
Unless you want to pour a new 6" concrete wall or line the room in thick lead, you are unlikely to be able to stop the sound transmission. Having maintenance seal the door and windows better may help if there is a leak problem. You can tell by listening around the door. If the sound is much louder near the bottom of the door than elsewhere in the room, you've found the leak.
The best way to approach this problem is to go to audiologist and get fitted for custom earplugs. They will make a mold of your ear and send it to a company like http://www.etymotic.com/hp/erme.html. You can select the filter up to a maximum of -25dB over a much more even bandwidth than cheap earplugs. It will likely solve the problem without introducing masking noise willy-nilly.
That being said, a loudspeaker playing white or pink noise could mask the problem, if you don't mind listening to it. I dislike constant noise, but that would be up to you.
If you're hearing "thumping" of footsteps or feeling the noise problem, that's a different ballgame: structure borne transmission. Buy your upstairs neighbors a thick rug so they don't impact the floor as hard or replace the ceiling with something more rigid...