Short answer. By recording a notice of lis pendens with the registry of deeds where the property is located. In an action affecting title or possession, the plaintiff, or a defendant claiming affirmative relief, may record this notice, naming the parties, the object of the case, and the property affected.
What the law says
In an action affecting the title or the right of possession of real property, the plaintiff and the defendant, when affirmative relief is claimed in his or her answer, may record in the office of the registry of deeds of the province in which the property is situated a notice of the pendency of the action. Said notice shall contain the names of the parties and the object of the action or defense, and a description of the property in that province affected thereby.
Rule 13, Section 19 — Notice of lis pendens. Read the full provision →
Who can record it, and for what kind of case
This notice is available in an action affecting the title or the right of possession of real property. It can be recorded by the plaintiff, or by the defendant when affirmative relief is claimed in his or her answer — so a defendant who is not merely defending but actively seeking relief of their own regarding the property has this option too, not just the plaintiff.
The notice has to identify the case and the property
A valid notice must state the names of the parties and the object of the action or defense, along with a description of the property in that province affected. This is what gives a prospective buyer or lender enough information to identify exactly which case and which property the notice concerns, rather than a vague warning with nothing to check against.
Constructive notice only starts from the recording, and only for the named parties
A purchaser or encumbrancer is deemed to have constructive notice of the pendency of the action only from the time of filing such notice for record, and only of the case's pendency against the parties designated by their real names. Before recording, there is no such constructive notice; the timing of the filing is what actually protects the party who recorded it.
The notice is not permanent — it can be cancelled
A notice of lis pendens may be cancelled only upon order of the court, and only after proper showing that the notice is for the purpose of molesting the adverse party, or that it is not necessary to protect the rights of the party who caused it to be recorded. It cannot simply be removed at will by the other side — cancellation requires the court to find one of these two specific grounds established.