Dear ...,
My congratulations on your wedding.I wish you a lot of happiness and good luck on your new life chapter.
Thank you for the invitation to your wedding but I'm afraid I will not be able to attend the ceremony.I hope you can forgive me.
Take care,
Your friend XYZ