You can get a list of WiFi networks that are currently available with the command
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport" -s
And then grep the output for your network's name (assuming it is a unique name, and not "NETGEAR" or something like that.
If the result is empty, exit from the script. If the result isn't empty, "exit 1" to indicate an error. Tunnelblick will abort the connection attempt.