On the following screenshot, the black region on the torus is controlled by the normal on the Principled BSDF. Now in Cycles rendering, I want the blue dots to only appear within the black region on the torus. So the blue dots should not appear on the red region. How can I achieve this please?
As taiyo describes in his answer, The "Color Ramp" always gets 0.5 value, for which it always outputs white color, which could be replaced with "Combine XYZ" node with $<1, 1, 1>$ values.
You are overriding all normals with $<1, 1, 1>$. This breaks the rendering for faces that have now normals pointing inwards:
This might be what you want, but probably it's just an effect achieved with trial-and error and you just like the black color going diagonally. If so, consider making an equivalent setup, that will work in Eevee and will not cause shading artifacts:
This is the same Dot Product taiyo uses in his answer, except I'm explicitly passing the $<1, 1, 1>$ vector for readability and I'm using it to simply control the color. Now it's easy to limit the blue ellipses to black area, just plug the logic into the black color:
And this is, I think, reproducing the exact look, but using a single shader and working in Eevee:
The key observation is that you plug (1,1,1) into the normals. This normal is spread across the donut and divides it into two parts: one where the normal is sticking out of the surface and one where not. Thus you can use the dot product with the face normals to detect which part you belong to. Get the face normals with the
Geometry node, calculate on which side of the border (dot = 0) you are and use that to noodle the rest together so it fits your desired goal. Setup: