Wraiths have the Life Drain action; on a hit, it forces the target to make a Con save to avoid having their max HP reduced:
The target must succeed on a DC 14 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken.
Specters also have a similar ability.
Temporary hit points are said to protect you from injury.
Temporary hit points aren't actual hit points; they are a buffer against damage, a pool of hit points that protect you from injury.
Will Life Drain's max HP reduction work if the damage you take is less than the temporary hit points you have?