I’m having this same issue without Yubikey in which hitting any key yields a system notification sound. The only thing that fixes it is a hard reboot. I think there is some warning/notification pop-up somewhere on the desktop associated with an app or service that is preventing users from entering text before acting on or dismissing it. The problem is that this pop-up is, evidently, invisible.
The last time this happened I shut down and the last thing I could see before the screen went dark was an error pop-up that I couldn’t find when it was on. It flashed only for a split second and I couldn’t make out what it was related to.
Just a hunch, but if there’s a way to see all active pop-ups that require input we’d probably find the culprit; I think this is a bug associated with a hidden pop-up.