It takes time to develop the "feel" for a comfortable guessing approach. For me, the most important point was remembering that I could guess at any moment of the question. Don't feel pressured to continue a problem simply because you already spent a minute or so on it. That lost time represents a sunk cost. What matters is now.
As a general rule, the problem needs to be set up by the one-minute mark. By the two-minute mark, you should be finished or putting on the final touches. If you're still huffing and puffing after two minutes, then either (1) the solution is probably out of reach or (2) you don't know what you're doing. At that point, you need to strongly consider guessing. The longer time passes on a question, the more valuable guessing becomes. Protect your time. I would, though, avoid blind guesses right from the start. If a problem looks simply impossible (which should be a very rare occasion), take a moment to see whether you can eliminate any answer choices.
But don't worry too much about guessing. Once you're ready for the test, you will be comfortable with your abilities and know when (and how) to guess. And if you study properly over a sufficient amount of time, guessing will be a rare occasion.
Also, see here for a guessing guide:
https://gmatclub.com/blog/2012/04/guessi ... -the-gmat/