How would I handle it? I'd put aside RAW and dig in with the player. This is a chance to do something with a little anticipation involved, which is always good.
Player: "I want to ready my magic missile spell to nail him if he turns invisible. Can I do that?"
DM: "Stop picking your nose. That type of split second timining would be difficult. It might not work. Are you waiting for him to start to fade out of existence, or are you looking for something else?"
Player: "Hmmm... I don't actually know that he cast a spell to turn invisible earlier, do I? Hmmmmm... I guess I have to wait to start to see him disappear."
DM: "Did you just eat .... never mind. I don't want to know. OK, you're going to focus on the second when he starts to disappear. You'll need to wrap up your spell in a very tight window. You'll have to make a tough arcana check for it to work - if he even turns invisible. He might not.
Is that what you want?"
Player: "Yes. I've got a pretty good arcana skill."
DM:" Well, he goes next, and he does cast an invisibility spell as he prepares to escape."
Player: "Shoot - this would have been easier if I'd triggered off spellcasting rather than them disappearing, right?"
DM: "Much. Regardless, as he disappears you wrap up your spell and release the magic. Roll Arcana. The DC is 18."
Player: ".... 17."
DM: "You release the spell and the magic missiles fly from your hand in his direction, but as he disappears they lose their lock on him and fizzle out, striking nothing."