There seem to be two basic methods of disabling a keyboard.
One method involves manipulating the keyboard's status in Device Manager. Although for many devices there is a right-click "Disable" option, I suspect that for a built-in laptop keyboard, the only option will be "Uninstall." The problem with using "Uninstall" is that Windows will automatically re-install the device when the computer reboots. I've seen one proposal to prevent automatic re-installation by temporarily installing a non-compatible driver (https://superuser.com/questions/717133/how-can-i-disable-laptop-keyboard-but-not-wireless-keyboard-windows-7):
- Open Device Manager
- Select "Update Driver"
- If prompted to check online or use existing drivers, choose existing drivers only
- Display incompatible drivers (or de-select "Only use compatible drivers")
- Choose one
- Restart
- Keyboard is now disabled (and in my case, touchpad too, which I'm fine with)
To restore the keyboard:
- Choose the compatible driver
- Restart
Although you could create a batch file to use Devcon (https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-general-commands) to uninstall the keyboard without having to open Device Manager and do things manually, that would be fairly complicated.
The second method is to use a third-party tool that will lock the keyboard for you. Caution: I have not tried this myself, but How To Geek is a generally OK website. https://www.howtogeek.com/howto/11570/disable-the-keyboard-with-a-keyboard-shortcut-in-windows/