An advanced directive, sometimes referred to as a living will or a do-not-resuscitate order, is a document that advises medical professional of what medical procedures you will consent to or refuse to consent to in advance.
If you have clear views on certain medical procedures, such as wanting to refuse blood transplants or dialysis, or not be kept alive by artificial feeding or hydrating, you can sign an advance directive that would advise doctors of your viewpoints and deny your consent to these treatments in advance.
This can work along with a Representation Agreement or as an alternative to one. With a Representation Agreement, typically you would advise your personal representative of your healthcare decisions and they would then advise the doctor of your views. An Advance Directive would allow the doctors to bypass your family and friends and rely on your document. This is useful if your personal representative is unavailable or does not share the same views or beliefs on end of life decisions as yourself. An Advanced Directive may come in handy in you ever need major surgery, as you could provide it to the hospital in advance.