You need to have all 4 stacks active if you want to complete Tal-rasha’s set dungeon.
To do so, you need to attack with 4 different elemental skills (fire, cold, lightning, and arcane) to gain all 4 stacks, then constantly attack with at least 2 of those different elements in order to properly refresh/reapply the buff, otherwise the buff will end and you’ll have to reactivate it by attacking with 4 different elemental skills again.