Focus can be set automatically in the desired field using Javascript, and tricks can be done to hide that field too - ie. set opacity so it's transparent, etc. You can make it work pretty smoothly for the end user.
Some of the original Yubikeys worked this way, and there are some barcode scanners out there that emulate keyboards too. I've seen some web based implementations go to great lengths to hide this fact.