What you are looking for is a summary of an actual passage from Walden. See below for the passage.
It’s not a direct quote, which may be why you are having difficulty finding it.
The actual passage is from Walden, Chapter 18, and I can’t tell if it’s part of the main passage or a footnote. Here are the two links I found:
And here’s the passage that relates to what you are looking for:
I learned this, at least, by my experiment: that if one advances confidently in the direction of his dreams, and endeavors to live the life which he has imagined, he will meet with a success unexpected in common hours. He will put some things behind, will pass an invisible boundary; new, universal, and more liberal laws will begin to establish themselves around and within him; or the old laws be expanded, and interpreted in his favor in a more liberal sense, and he will live with the license of a higher order of beings. In proportion as he simplifies his life, the laws of the universe will appear less complex, and solitude will not be solitude, nor poverty poverty, nor weakness weakness. If you have built castles in the air, your work need not be lost; that is where they should be. Now put the foundations under them.”