Short answer: Current autofocus systems only work when the AF area contains high contrast. The places where it doesn't work don't contain enough, and the areas which do work, do.
Here's what's going on in more detail:
There are two different types of autofocus systems in modern cameras.
One is the contrast-detection AF, which is used in most point and shoot cameras and in live-view in most DSLRS. This works by moving the lens back and forth until the setting which gives most contrast between adjacent pixels is found. Obviously, this requires actual contrast in the subject — you can't focus on an all-white wall.
The other type is phase-detect AF, which uses a beam-splitter to tell whether patterns of light and dark are back- or front-focused, and moves then lens accordingly. (This is what you're probably using with your Nikon DSLR.) Phase-detect AF also requires the focus area to have a pattern with high contrast in order to work.
There's more technical information about this here: How does autofocus work?, if you're curious.
In your example, the red points which don't work for focus are on a relatively plain gray area. There's simply not enough contrast for the AF system to do its thing. The green points, where you are able to focus, have clear, high-contrast detail — perfect.