If the question mark wasn't there, it wouldn't be a question. A question mark is put at the end of a question. If the sentence isn't a question, you don't put a question mark.
If it wasn't a question it would be a random statement with no point whatsoever. It /needs/ to be a question. And you can phrase a statement in a questioning way, you do so in real life all the time. In literature, as someone is not speaking them for you, you show this by using a question mark.
It's a declarative statement; he's declaring that he thought she wasn't talking to them.
A question mark is used only at the end of an interrogative statement, regardless of whether it wants a reply or not. The sentence was not interrogative because neither the subject, nor the verb, nor the direct object, nor the indirect object is unknown.
By saying he thought she wasn't talking to them, the question is 'Why /are/ you talking to us?' However, this would be rude, so it's asked indirectly, by making a statement, and using intonation, as indicated by the question mark, to signify that she ought to treat it as a question.
Well, it's about that time of night where I get insufferably stubborn and start acting retarded, so for the good of everyone who will get very mad at me if I continue to try to speak intelligently, I'm going to pull a Tootsie Pop on this one and go with "the world may never know."