Dear…
Thank you for the invitation to __(type of function)__. What __(an honor it is to be on your guest list/a wonderful event this is)__. Regrettably, however, I must inform you that I am unable to attend due to a prior commitment. It is unfortunate that I cannot be there __(example: to visit with you and my other former colleagues)__ as I would have enjoyed that very much.
Please do pass along my regrets to everyone attending. I send you my best wishes and hope that __(everyone has a fabulous time/your –type of function– turns out to be a great success/etc.)__.
Sincerely,