Some spells allow to target willing creatures and specify what unwilling ones should do (usually, a saving throw) to avoid the magical effect (see Scatter, for example).
Other spells use wording such as "up to \$X\$ willing creatures", "You touch a willing creature" and similar, but they do not have any rules for not willing ones.
Is there any standard/common way to handle spells belonging to the latter case? Does the magical effect take place?
Most of these spell are buffs, hence usually the targets are willing creatures. Down below I report a couple of example situations in which a creature may want to avoid the spell's effect.
You make a calming gesture, and up to three willing creatures of your choice that you can see within range fall unconscious for the spell’s duration. The spell ends on a target early if it takes damage or someone uses an action to shake or slap it awake. [...]
The party is fighting a group of 3 ogres and they are heavily injured, they want to run away from combat: the bard casts Catnap and the ogres fall unconscious even they are not willing to do so.
This spell grants the ability to move across any liquid surface--such as water, acid, mud, snow, quicksand, or lava [...]. Up to ten willing creatures you can see within range gain this ability for the duration.
If you target a creature submerged in a liquid, the spell carries the target to the surface of the liquid at a rate of 60 feet per round.
A group of enemies cast Water Breathing for fleeing under water from the party. The wizard casts Water Walk to force them to emerge from the water: now they are easy targets for the ranger.