Well, the second sentence is wrong. If you use present perfect, you don't give "when". Give the time of the action only with past simple.
"She has had two pens. Why do you want to give her a third?" OK, in this example "had" implies "used". She was given two pens earlier and should still have them; she shouldn't need another.
"She had had two pens." Needs more information. For example, "She sat holding one pen and cried. She had had two pens." ie. She lost one of her pens at one point, which explains her crying. This is pretty much how past perfect works.