Pair magic keyboard with iPad
I went to the Genius Bar to solve this. They did the standard procedure and the device paired.

The explanation for why it was not working for me was that a Magic Keyboard will not pair while it is charging. I had the keyboard plugged into a USB port for charging at the time. To use or pair the keyboard, make sure it is unplugged.