Derogation, in civil law and common law, is the partial suppression of a law. In contrast, annulment is the total abolition of a law by explicit repeal, and obrogation is the partial or total modification or repeal of a law by the imposition of a later and contrary one. It is sometimes used, loosely, to mean abrogation, as in the legal maxim lex posterior derogat priori ("a subsequent law derogates the previous one").
A UK law permitting warrantless arrest and detention on suspicion of terrorist involvement was found to violate protected rights, according to the ECHR decision in Brogan v. The United Kingdom in which the court reviewed the arrest of four persons arrested in Northern Ireland under a 1984 British law allowing a special powers derogation from the normal proscription of warrantless arrests.
In terms of European Union legislation, a derogation can also imply that a member state delays the implementation of an element of an EU Regulation (etc.) into their legal system over a given timescale, such as five years; or that a member state has opted not to enforce a specific provision in a treaty due to internal circumstances (typically a state of emergency).
In canon law a dispensation affirms the validity of a law, but asserts that the law will not be held to apply to one or more specific persons, for a specific reason. (For example, while the Catholic Church's canon law does not normally recognise gender transition, an intersex woman may present appropriate medical documentation to seek, and possibly receive, a dispensation from the Holy See to live and be recognised as a man, or vice versa.) Derogation, on the other hand, affects the applicability of a law in general.
A non-canon-law analogue of dispensation might be the issuing of a zoning variance to a particular business, while a general rezoning applied to all properties in an area is more analogous to derogation.