How does Squirt's Necklace work?
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!
From personal testing I have found that the frozen affix from elites will cause the buff to vanish. Looking at the diablo bug page here shows that some other things will cause it to vanish as well (they mention possibly poisonous clouds from when accursed die and the trails anarchs leave when they charge). I only personally tested the frozen however.