The top-left co-ordinate of the client section of a window is the view centre minus half of the view size.
e.g.
sf::Vector2f topLeftCoord{ view.getCenter() - view.getSize() / 2.f };
However, there is another approach which makes life a lot easier: use two views instead of one.Use your main game "scene" view to centre on the player and move around the world (for example).
Then, use a top layer "UI" view to draw the user interface.
This "UI view" would be set to the size required (usually the same size as the client window) and would also never move.
The "scene view" would be moved around as you do already.
Then, you just switch views before drawing (and also before doing anything that takes the view into account such as converting co-ordinates like the mouse position).
e.g.
window.clear();
window.setView(sceneView);
window.draw(map);
window.draw(hero.sprite);
window.setView(uiView);
window.draw(r); // your test rectangle
window.draw(ui); // the rest of the ui you want to draw can be drawn here
window.display();
You can set up the ui view before the main loop and never need to change it (in almost all cases).