xinput disable
You can disable input devices under X with the xinput command. Run xinput list to list available devices then xinput disable … to disable a device by name or number.
Udev is probably the way to go, but X11 is the way I know off the top of my head.