Sometime solutions that are obvious are difficult to see because you image the solution must be much harder than it really is. Recently I had to recover a forgotten root password for a virtual domain, DomU, on a Xen box for one of our clients.
At first I tried looking for a way to boot the effected DomU into single user mode. A search of parameters to pass to the kernel in DomU did not reveal much other than the "extra=" parameter in the Xen config file. It also dawned on me that passing "single" on the command line is a uniquely Linux thing so what about Windows and BSD virtual machines? The config file probably wasn't the way to go.
There where other issues to sort out so I got on with that, then when making a cup of coffee it came to me. The solution was so simple one feels stupid not having thought of it immediately.
I logged into Dom0, mounted the virtual disk, in this case a file, "chroot" into the environment and then issued a "passwd" command to change the root password. This will work equally well for physical partitions as for file systems.
This should work for virtual BSD systems too. I am not sure how to handle virtual Window machines though.