If you say "I've been married for 10 years," I assume that you are still married. I am not certain if the sentence has an ambiguity.
If you want to convey the idea that you are divorced now, one simple, short, unambiguous phrasing is "I was once married for almost ten years." "Was once" indicates that you are not married now.
If you want to convey the idea that you are still married, you could say "My wife and I have been married for ten years." By including the word "wife," rather than "ex-wife," you convey the idea that you are married now, to the person you have been married to for ten years."