This would be cool especially if it worked seemlessly with the Windows Login with YubiKey (Beta) product.
I found a separate piece of software at http://www.5group.com/wordpress/tag/yubikey/
It is called autolock it enables a similar functionality unfortunately it has to be configured each time at start-up.
Licensed under GNU General Public License, version 2 a free tool is available
for download here. http://www.5group.com/downloads/yubico/ybAutoLock-1.0.exe
If you still want to lock your PC when the YubiKey is removed, download Rohos Logon Key http://www.rohos.com/products/rohos-logon-key/
You can configure it to do lots of things when the key is removed, like sleep, hibernate, shut down, lock
I hope this helps, if you need any help with it, like configuring it or anything like that, then make a new topic and mention it here. I'll help as much as possible.
I tried to attach the setup file but its 0.80 Mb too large, sorry.