Is it ever ambiguous if 几 means "how many?" or "a few"?
It depends on your tone and context.

If the statement itself does not have any prior or future statements, then it would likely be a question.
Here are the possible context：

从上海到东京坐飞机要几个小时 ？ In this case, you are asking a question， your tone would also be in an inquiring manner, to make it clear its a question

从上海到东京坐飞机要几个小时, 你总不能要我每天来回吧？ In this case its a statement (It takes a couple hours from Shanghai to Tokyo, you can't expect me to travel between them everyday ?）