Pressing alt-space or option-space leads to insertion of a "non-breaking space" in OS X. A lot of programming applications do not like this character and complain with a message like the following:
/path/to/file.cpp:327:17: error: stray ‘302’ in program
/path/to/file.cpp:327:17: error: stray ‘240’ in program
One method to disable this key combination is by creating the file "~/Library/KeyBindings/DefaultKeyBinding.dict" with the following content:
"~ " = ("insertText:", " ");
But this does not disable it for all applications but just for the ones that recognize this file. Xcode for example does not.
Another workaround method (my favourite) to prevent this is to enable the option-space combination as an Accessibility Option. Go to "System Settings -> Keyboard -> Shortcuts -> Accessibility". Then e.g. activate the "Invert colors" option and define the shortcut option-space for this option. Now everytime you accidentially hit option-space the colors of your screen will invert but no character is inserted. This mode cna be undone by pressing option-space again.