I've had this happen twice. In both cases, I had already decided that I was going to move on. In one case, I had already been in contact with another organization that ended up being my next employer.
The proper response: accept the raise. In my case, I've typically worked outside of metropolitan areas, for small companies, and so I knew each owner of the company. And I performed my standard response: go around (on a break) and personally thank each person who had a say in authorizing the raise. I appreciate the kind gesture.
Still, I left. And leaving has never been a nice thing to do for a current employer. However, my decision to leave wasn't financially motivated, and so the raise didn't really change my reasons for deciding to depart.
I believe that in both cases, I did mention the raise in my letter that notified them of impending departure. The letter said something like, "I appreciate the recent raise that has been provided. [However,] I still do plan to engage in this alternate plan/opportunity..."
In neither case did the raise come with attached strings of remaining, and so I figured it was just a business decision that probably didn't work out the way they hoped for. But, then again, when I've decided to leave, I've already decided to pursue a course of action that I know is different than what my current employer hopes for, so that's already been determined to be an acceptable outcome.
Maybe giving me a raise was an incorrect business decision on their part. (Maybe they should have tried to trade me the raise for a statement of intent to remain, which I, in fact, would not have given in either case.) I don't bring up the awkwardness of any perceived potential mistake, as I don't want to rub that in their face. I only mention it at all because I did appreciate the nice gesture, and so I simply wished to re-communicate an acknowledgement of that appreciation, despite my decision of making a different career move,
In both cases, they quickly expressed that they weren't happy to see me go, and that continued to be the position shown up to my last day there. One was open to having me work for them years later. (Didn't end up happening.) The other is more recent, and after my employment was over the CEO has already (in March) been talking about inviting me (an ex-staff member) to the company Christmas party. How I handled it clearly didn't badly burn any bridges.