Knock Off cannot remove a Z-Crystal from any Pokémon, a Mega Stone or Orb if the target could use it to Mega Evolve or undergo Primal Reversion, a memory if the target is Silvally, a Rusted Sword from Zacian, a Rusted Shield from Zamazenta, any of the Hearthflame, Wellspring, or Cornerstone Masks from Ogerpon, or a Booster Energy from any Paradox Pokémon (excluding Koraidon and Miraidon), even if it hasn't consumed the item because its Ability triggered from the appropriate weather or terrain condition instead.
In addition, items in Tera Raid Battles won't be removed.
Knock Off (Bulbapedia)
Trick fails if either Pokemon is holding...
- e-Reader Berry
- Mail
- Z-Crystal
- a Drive, if either Pokémon is Genesect
- a Mega Stone, if either Pokémon could use it to Mega Evolve
- a colored orb, if either Pokémon could use it to undergo Primal Reversion
- a Memory, if either Pokémon is Silvally
- a Rusted Sword, if either Pokémon is Zacian
- a Rusted Shield, if either Pokémon is Zamazenta
- a Booster Energy, if either Pokémon is a Paradox Pokémon (excluding Koraidon and Miraidon)
- a Wellspring Mask, Hearthflame Mask, or Cornerstone Mask, if either Pokémon is Ogerpon
Trick (Bulbapedia)
Not all of these items are obtainable in Gen IX, but items are usually kept in the game's code as holdovers because it's easier than deleting them. This means you could get them through illegitimate means, so I included them in the answer.