How to prevent resetting a login password in single user mode or from a recovery partition?
It can be prevented. Boot up your mac with your Mac OS X install DVD, and after it has loaded, go to utilities and select Firmware Password Utility. Select the checkbox "Require Password to start this computer from another source" and type in a password.

This password will prevent people from:


Booting CD/DVDs
Booting into Single User Mode
Booting into another OS stored on another partition or disk


No. 2 is the one where people type commands in it to reset the setup data in which they can go through the setup procedure and set up a completely new administrator account.

However, the best way is to keep your mac with yourself. Anyone with root/administrator access can bypass this feature, by typing a few commands in the terminal. Keep your password secret and complex.

It is also worth mentioning that the EFI password is easily crackable. Some people had success with resetting the PRAM and gaining access, while others used exploits in the OS X system to gain root access and disabling the password using terminal commands. The way Apple encrypts is also very lax and you should make it very much different from your OS password.