Actually, the opposite is true. Caffeine potentiates pain medications -- makes them work better and faster. That's why some medications contain caffeine.
I was unable to find any evidence that caffeine reduces narcotic pain medications effectiveness. Narcotics work through their effects on the opioid pain receptors. I couldn't find any evidence that coffee or caffeine affect them.