You use the simple past when speaking in the present. For instance, you're at a bar with a friend, and you see a woman and she waves at you. Your friend asks if you know her, and you say "Of course I know her - we were married for ten years." You say that because in that moment you are speaking in the present, using the present form know, about something that happened in the past and then ended.
However, if you and your friend are talking about your first marriage and how it ended, you would tell him the story in the past, using past forms:
"We were living in New York and I was always going out with other women. My wife found out and asked me for a divorce. We had been married for ten years."
Here, you use the past perfect because you're talking in the past about something that happened, or started happening, before that past, i.e. before the point in the past when your wife asked you for the divorce.