I have one of the new Apple Magic Keyboards. Magically, none of the function keys on the top of the keyboard, nor the fn key on the lower-left of the keyboard are responding when it's paired with my MacBook Pro (2012), running El Capitan. It works when paired with a different MacBook Pro, though.
Also, I had an older Apple wireless keyboard that suddenly started exhibiting the same behavior, which is what prompted me to buy this new one in the first place. So it looks like a software thing on this particular Mac. Any suggestions? I'm guessing I need to trash some keyboard prefs, but I'm not seeing anything that looks obvious in my ~/Library folder.
EDIT: Just adding that I tried in the Guest User account, and had the same issues. I then tried restarting in Safe Mode, and the keyboard worked fine, once I plugged it in via the Lightning Cable and paired it with the computer. So it's something borked on the system level, but again, I'm not sure what preference file to zap. Will keep looking!