how to turn off my keyboard on my macbook?
I would recommend Karabiner Elements. It's the successor to Karabiner, and works on macOS Sierra. There's an option under the devices menu to disable the build-in keyboard while another keyboard is selected, which should do exactly what you want.