Formal invitations often require a written response and, if declining, the letter may follow the following basic structure: "Mr and Mrs Guest regret that they cannot accept the generous invitation of Mr and Mrs Host for dinner on Saturday, 12th December." As a general rule of thumb, etiquette dictates that responses to formal invitations, whether accepting or declining, should use a similar structure and phraseology to the invitation itself.
In fact, the same goes for less formal invitations, although these may not require a written letter in response. Sometimes they may simply require clicking a link on a social networking platform.
Either way, explanations are optional. If the hosts are close friends, however, then an explanation for declining the invitation may be given to them personally.
It is poor etiquette to respond to an invitation in a non-committal way. It is especially rude, for instance, to tell the hosts that attendance is contingent on one's availability or, worse, on who else is attending. When a definite answer cannot be given, it is best to tell the hosts that a decision will be made as soon as possible — and then to follow through on this promise.
If, for any reason, a formal response to a formal invitation is not possible, then the hosts should be telephoned or otherwise contacted.