This is a working solution for those using an external monitor on their MacBook Pro's running Yosemite. The previous terminal commands for Mavericks no longer works on Yosemite, so this how to do it.
More info on the solution can be found here: (all credit goes to rwg)
Open Terminal and enter in the following:
sudo nvram boot-args="niog=1"
sudo nvram -d boot-args
Steps after entering terminal command:
1) After putting in the terminal command, reboot and close the lid immediately
2) Keep the lid closed during boot up and once logged in, open the lid
3) Viola! The MacBook Pro's screen is turned off
*Note: If in sleep mode, just close the lid before waking the MacBook Pro and open the lid once again after logging back in.
Want to master Microsoft Excel and take your work-from-home job prospects to the next level? Jump-start your career with our Premium A-to-Z Microsoft Excel Training Bundle from the new Gadget Hacks Shop and get lifetime access to more than 40 hours of Basic to Advanced instruction on functions, formula, tools, and more.