Only automatically connect to certain Wi-Fi networks I have an HTC Desire with Android 2.2. 

My problem is that there may be open Wi-Fi networks nearby that require a password once connected, e.g. hotspots at coffee shops. My phone connects to these, thereby blocking the 3G connection.

What I want to do is always use 3G unless I'm in range and connected to a list of certain Wi-Fi networks.
Go into your Wi-Fi settings. Long press on the networks that you don't want to automatically connect to and tap 'Forget'.