Certificates stored on hardware tokens no longer show up in KeyChain on recent versions of macOS. But you should still be able to refer to them by using the certificate hash.
For instance
codesign -s <cert sha1 hash> -f <binary to sign>
See https://developer.apple.com/forums/thread/744992