I've been digging around in the reference library and just can't seem to find the answer here. I'm assuming there's some API somewhere that I can query to find out if an external hardware keyboard is in use or not.
Update I just tried the EAAccessoryManager.connectedAccessories from the ExternalAccessory.framework. That was a no-go, it returns an empty array when the hardware keyboard is enabled.