You learn how to create selections to constrain operations and filters.
It's more tricky than it sounds.
First of all you need to select the main subject and place that on a separate layer on top. Then you also need to knock out the same from the underlying layer, otherwise it will contribute to the blur.
Second, none of the blur tools in Photoshop give a credible result. It doesn't look blurred as much as viewed through frosted glass. Even the lens blur filter gives this frosted glass effect. A proper lens blur is a very complex optical phenomenon, and to create that illusion in software requires very sophisticated mathematics.
There is a plugin from Alien Skin that is the most convincing I've seen to date, it used to be called Bokeh but is now apparently called Exposure with some added functions. Even so, use very carefully and sparingly; it's no magic bullet. Nothing's worse than easily spotted slapped-on effects.
My experience has been that the Field Blur needs the entire image to work on, or you will get strange effects around your foreground object. It also is a pain to adjust if you discover, after the blurring, that your foreground selection was not perfect. So my approach is to do the opposite of what the above poster suggested. I duplicate the layer and then apply the field blur on the top layer. I then turn off the visibility of that layer, go back to the original layer and create a selection for the background area you want blurred. I then go back to the duplicated layer, turn visibility back on and apply the layer mask. You can now tweak that mask at any time if you spot issues with the foreground object.