When you are on the unanswered page, $this->template will be 'unanswered'.
If you mean on an individual question, the simplest way would be to check $this->content['q_view']['raw']['acount'] which has the number of answers.
However, I would not recommend it. It's a bad idea for the same page to switch between indexing and no-indexing, it may make search engines slower to update after you get an answer.
Plus you're blocking many other pages with your approach. The tags/categories pages can be useful if people search for a certain topic. Getting visitors onto any page of your site means they might stay around.