You want to know if it's present, or setect when the state changes (inserted or removed)? I've never tried but I think the first may be done by looking in the registry at the HID driver - it likely builds some keys when the device is in. FOr the latter you can probably look at the device notification queue to get notified when the state changes (IIRC there's an example on these forums for doing similar when a USB storage device is inserted or removed).
It looks like you can probably walk the HKLM\Drivers\Active child keys and look for "HID1:" to detect the mouse - though I'm not sure if that would also show up for the keyboard as well.