The best way I find is to run the following command in the terminal, which seems to put it on the quietest setting:
sudo nvram SystemAudioVolume=" "
That's a space between the double quotes. Some people suggest different values to disable it like the following but the space is the only value I get to work consistently:
sudo nvram SystemAudioVolume="%80"
sudo nvram SystemAudioVolume="%00"
It would be nice if it just accepted integers e.g 0-3. To reset it, you can either reset the PRAM with command-option-p-r at boot or with the following:
sudo nvram -d SystemAudioVolume
I've noticed that sometimes plugging in and unplugging earphones resets it, which could be why people have made preference panes etc but try it and see. I don't mind the noise being separate from the audio system but there's no need for Apple to make it so loud.