How can I automatically disable the onscreen keyboard when a Bluetooth keyboard is connected?
Not automatic (per se), but you can use something like Null Keyboard which is a null input method you can enable when you have your Bluetooth keyboard connected so the soft keyboard quits from popping up.

Also, in my experience, Cyanogenmod9 ICS ROMs prevents the keyboard from appearing when an external one is connected. It might be worth seeing if they have a distribution for your device.