Yosemite disables audio output on external monitor change
Solution 1:
Look at the What If I'm Running the Stable Version? of this article.
So, open System Preferences, go to the Sound menu and then look in the Output tab to see which device is used for output.
I confirmed that when I unplugged my HDMI monitor and plugged it back in, the monitor was selected by default, but when I then manually selected Headphones and then unplugged an reconnected my monitor again, this time Headphones stayed selected.