I'm pretty sure the Windows XP OEM license does not allow it to be used for VM guests. Last time I checked, you needed retail licenses for VM use. They probably changed this in later versions, although it may have specific requirements about the host OS.
This depends entirely on the laws/jurisdiction of the particular country you are in.
In Germany, it has been specifically ruled by the federal court that it is legal to sell such OEM licenses, and that any terms in those licenses trying to restrict the kind of hardware the software is running on are invalid. So, in Germany at least, you can use OEM licenses in a VM. In this situation, even pushing an argument that a VM is not hardware would not work -- in consequence, the guest OS is executed on exactly the same hardware as the VM itself, which nobody can deny.
However, if you would need to do modifications/hacks on the OS to make it run on a VM, as it might be necessary with MacOS for example, then those modifications might violate the license terms&conditions.
But... different countries, different rulings.