Disabling sound output devices (e.g. Internal Speakers) in OS X
Solution 1:
kextunload is a formal interface for unloading kexts in the Darwin OS and in Mac OS X.
Unload the system audio driver:
sudo kextunload /System/Library/Extensions/AppleHDA.kext
Load it again:
sudo kextload /System/Library/Extensions/AppleHDA.kext
If not "AppleHDA.kext", another kernel extension in /System/Library/Extensions/ may be what you're looking for.
Solution 2:
I don't know of any way to disable internal speakers. However, you might look into a solution like ControlPlane, which can automatically set your default audio output (and many other system settings) based on environmental factors of your choosing, e.g. having a specific display connected, or the presence of a specific WiFi access point.