Taking damagein case of the Squirt's Necklace is an event, where you
lose HitPoints due to an attack, skill or effect of an enemy as well as after death effects.
You can therefore count in ground effects and damage through map objects. You see you most likely take damage rather frequently and need 10 seconds to reach the full buff effect again (aka 10 stacks).
The only exception to taking HitPoint damage is self-inflicted damage like f.e. necromancer skills that cost life.
Losing this effect under the effect of a shielding pylon is a known bug, sadly, and still not yet fixed.
Keep in mind, that you don't lose the buff while taking damage, but rather when you lose any HitPoints. Because of this it is f.e. on wizard a strategy to focus on shielding your life pool, since absorbed damage does not count towards taking HitPoint damage.
Damage instances that you dodge also don't remove the effect of squirt's.
Hope this somewhat clears things up for you. Good loot and useful primals!