From my maths teacher: Don't reach for the stars if you cannot reach them.
Apparently, the answer to the problem he was asking us to answer when he said that was undefined or there's no solution to it. The quote simply means that there are times when something is impossible and so don't exert and waste your efforts on it.
This reminds me much of the Aesop's fable involving a turtle who was very determined to learn flying. So he asked an eagle to teach him. The eagle looked at him and said that he isn't made for flying. However, the turtle kept insisting so the eagle took him up to the sky and at the height, dropped the turtle, leading him to his death. *shudders*