In WinNT4 one can find it as pure text:
In Win2k/WinXP the key is located here but is encrypted:
[HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Windows NT \CurrentVersion]
Note if the ProductId has the format "12345-nnn-nnnnnnn-12345" then "nnn-nnnnnnn" is the CD-Key.
If the Win2k/WinXP was installed unattended then the cd-key might be found here:
[HKEY_LOCAL_MACHINE \SOFTWARE \Microsoft \Windows NT \CurrentVersion]
Related Change WinXP CD Key using WPA