What to say to a student who has failed?
I think that you explained the situation very clearly and sensitively in your third paragraph, and that you should send a message to the student along the same lines. All you'd really have to say is that while you of course sympathize with the student, her performance on the final exam makes clear that she did not gain sufficient mastery of the course material to pass the class.

I'll add that I think your message to the student should be clear and concise. The longer your response to the student the more likely it is that you'll wind up in a long, drawn out exchange that stresses both of you out while benefiting no one.