How does Pithing Needle work with abilities on the stack?
Pithing Needle only prevents future activations of the chosen permanent's abilities once it's on the battlefield. It has no effect on the chosen permanent for previous activations of its abilities, even if an ability of that permanent is currently on the stack.
Pithing Needle's static ability creates a continuous effect. It is in effect as soon as and as long as the Needle is on the battlefield, but not before.

611.3. A continuous effect may be generated by the static ability of an object.
611.3b The effect applies at all times that the permanent generating it is on the battlefield or the object generating it is in the appropriate zone.

Pithing Needle prevents the activation of a permanent's ability. The act of activating an ability is a process that, once finished, can't be prevented retroactively. Activated abilities can be countered by certain cards, just like spells, but Pithing Needle does not counter abilities.


Activating Activated Abilities

602.2. To activate an ability is to put it onto the stack and pay its costs, so that it will eventually resolve and have its effect. [..]

This is the rule specifically describing the Needle's effect. However, by the time your opponent has activated the ability, the ability was not prohibited from being activated.

602.5. A player can’t begin to activate an ability that’s prohibited from being activated.