It can and does happen. Registars deny doing it, of course, and some people even suggest that it's ICANN who does it. It's also possible that a name can be registered by another person just by total coincidence, they thought of the name just after you did and they registered it.
A lot of domainers search to see if domains are available by typing it into their browser's address bar and seeing if there's a site there. If there's not one they can search from a registrar's site when they are ready to register it.
The moral of the story is:
If it's available and you want it,
register it immediately, because if you don't someone else might.