I was asked to turn my comment on the accepted answer into separate answer. I see it required only 10 minutes to go below the zero.
At the end of the day, the truth is always the best business.
Maybe you can consider sharing the situation as it is. Between the lines you said you are already financially prepared:
I'm planning to leave within the next couple months. I'd like to start doing some freelance work and travel.
Because starting freelancing and traveling do not go very well (as a long-term plan) along with tight finance.
So if there is • not a very good reason to play tactical games with others and • you are determined to leave and • you consider relations in the company to be good (without misusing etc...) and • you have sufficient money for some period without regular income, then it might be better to share your thoughts openly where needed (= when they directly ask you about that). Simply to keep your personal integrity.
You do not need to tell ensured "for sure I will leave" because such a statement is not true anyway! (It is still only your wish which did not became reality, yet.) Sometimes things go different from how we plan them. Much closer to reality is to say that you consider (or dream of – if more appropriate) freelancing and traveling in mid-term horizon if all goes good and you will not be forced to go your current way by unforeseen circumstances. And the original topic is still valid: so when concentrating on goals inside current job, you want to work on these and these... (no need to discuss the future plans, if not inevitable.)
Admitting your thoughts will allow you to be more free from various inner restraints which prevent us from giving ourselves as we are (but instead they force us to constant checking if we are still hiding some things sufficiently enough). From daily smalltalks in the kitchenette (by far not mentioning any plans) to deeper talks which sometimes occur. Therefore, I would view the categorical statement
"NEVER under any circumstances you should reveal plans..."
from the accepted answer as valid only in some reasonable context, but oversimplified to be recommended as general enough. If I want to leave because a time has come and I am prepared (in all the most important areas), it does not matter too much if I already have secured another job or not. I can live few months from financial reserve and in some cases even take some rest before reaching for other opportunities. In the IT industry, this is common, many programmers around me gladly do not do anything for few months before finding and starting a new job. (And in am not in the relatively rich North America or Western Europe, but in the Central Europe.) As my friend, a CEO, says: the truth is always the best business. (Because it is closest to the reality. Lies or tacticizing may work, but on the long run, they cannot beat the former.) If you won't learn this now, you will find yourself learning this during your freelancing period.
Throughout our career we are expected to learn how to be truthful, otherwise we maybe achieve something, but we lose ourselves – what cannot be compensated by any achievements.