Accoustical foam will help make a room sound better, but will do zero for soundproofing. Soundproofing an apartment is difficult, because most soundproofing needs to be done during the construction phase to be most effective.
There are three rules in soundproofing:
1. Airtight. If a room is not airtight, all else doesn't matter. Spaces around normal interior doors are the number one issue, but there are others.
2. Dense wall partitions. (And ceilings and floors) Dense, heavy walls are require a lot of energy to vibrate.
3. Vibration Isolation. The seperation of two spaces with dead air space, or with some sort of flexible material will go a long way toward isolation
The closer you get to all three of these, the better your soundproofing will be. Keep in mind that soundproofing is a matter of degrees. Making a room capable of rock concert levels, while the next room is dead-quiet, is very difficult. How much sound transmission your willing to live with will greatly effect your project.
You may want to go to
www.soundproofing.org. They have a good deal of information about some options that you have.