Open iTunes and go to Edit>Preferences>Devices and check the box "Disable automatic syncing for iPhones and iPods" and choose Ok. Then connect your iPhone.
If at any point you get a message that your phone is linked to another library and asking if you want to link to this one and replace all your songs etc, press "Cancel". Pressing "Erase and Sync" will irretrievably remove all the songs from your phone.
iTunes will only let you copy your iTunes Store purchases directly from an iPod or iPhone to the computer, you'll find details in this article:
Copying iTunes Store purchases from your iPod or iPhone to a computer
Purchased applications can be downloaded over again, see this article for details:
How to redownload purchased applications from the App Store
For everything else (music from CDs, other downloads and including iTunes purchased songs and in some cases, videos and games) there are a number of third party utilities that you can use to retrieve the music files and playlists from your iPod Touch or iPhone. You'll find that they have varying degrees of functionality and some will transfer data (such as playcounts and ratings), movies, videos, photos, podcasts and games as well.
A selection of iPod/iPhone to iTunes utilities:
Senuti Mac Only (iPod Touch & iPhone compatible)
SharePod Windows Only (iPhone and iPod Touch compatible)
TuneJack Windows Only (iPhone and iPod Touch compatible)
iPodRip Mac & Windows (iPhone and iPod Touch compatible)
Music Rescue Mac & Windows (iPhone and iPod Touch compatible)
iPod Music Liberator Mac & Windows (iPhone and iPod Touch compatible)
iGadget Mac & Windows (iPhone and iPod Touch compatible)
iRepo Mac & Windows (iPhone and iPod Touch compatible)
iPod Access Mac & Windows (iPhone and iPod Touch compatible)
TouchCopy Mac & Windows (iPhone and iPod Touch compatible)