Derogation is the partial suppression of a law, as opposed to abrogation--total abolition of a law by explicit repeal--and obrogation--the partial or total modification or repeal of a law by the imposition of a later and contrary one. The term is used in canon law,civil law, and common law. It is sometimes used, loosely, to mean abrogation, as in the legal maxim: Lex posterior derogat priori, i.e. a subsequent law imparts the abolition of a previous one.
Derogation differs from dispensation in that it applies to the law, whereas dispensation applies to specific people affected by the law.
That is to say, 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 general applicability of a law.
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.
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).