Using Only an External Monitor with a MacBook Air or Pro?
Set the boot-args NVRAM variable to iog-0x0

sudo nvram boot-args=iog=0x0


and restart to apply the changes.

It restores the pre-10.7 clamshell mode behavior where the internal display does not turn back on after you open the lid of a laptop. The laptop will also go to sleep when you close the lid even when an external display is connected.

To undo the changes, run sudo nvram -d boot-args and restart.