The best thing you can do is spend some of the peaceful moments while riding your bike to figure ways that you can identify these potentially hazardous situations before they happen and adjust your actions to avoid the danger.
This is much more achievable if you ride the same route every day, e.g. a commuter, because you know the route after a while and get to know how best to avoid the risks. It's still achievable on a new ride to some degree just by using those experiences from your regular rides and applying them in new situations.
For me, I've learned the most important time to be cautious is that time when you are feeling totally awesome. That's when you may not be focused on what you're doing.