Another way that doesn't require looking through a ton of output is:
sudo acpidump -b -t MSDM | dd bs=1 skip=56 2>/dev/null;echo
acpidump dumps the table (default in hexdump format), but the -b options tells it to output the raw data. Since we only need the last part of the table, pipe the output into dd, but but skip the unnecessary junk. Finally, add an echo at the end to make it terminal-friendly =D
acpidump -t MSDM will work as well, but the key is broken over multiple lines, making it hard to copy.
Update thanks to Lekensteyn:
New versions of
acpidump shipped with Ubuntu work differently than described above. The -b flag causes
acpidump to write to a file under all circumstances, so an alternative method is to use the command
sudo tail -c+57 /sys/firmware/acpi/tables/MSDM
A legitimate Windows 8 installer should automatically detect the key in the ACPI and continue installing with the built-in key.
It should be noted, however, that I used this method to try to install Win8 in a VM using my own product key, but it automatically deactivated saying that the product key was in use. So, it's of little use in all reality. Since Win8 OEM keys are designed to be tied to that specific computer, you'll hit a brick wall if you ask Microsoft to unregister the key so you can use it in a VM, let alone another computer.
The only way you could use the key is if you had never booted into Win8 to begin with or weren't connected to a network when you did. Even so, if your VM/new computer is ever allowed to connect to the network, it will automatically register the key making your actual installation unusable.