There's a duplicate question of this somewhere here. Darn if I can find it though so....
Create a separate layer for your stroke and add a mask to that layer.
- Duplicate the original artwork layer.
- Set the Fill opacity to 0% on the Layers Panel
- Remove all the Layer styles from it except the stroke.
- In the Blending Options for the Layer Styles ensure
Layer Mask Hides Effects
is checked
- Add a Layer Mask to this stroke-only layer
- Paint on the layer mask to hide portions of the stroke.
You can then Group these two layers to keep them together, or combine them into a Smart Object.
This method works for most Layer styles if you want to hide portions. It will also work in reverse - if you wanted the stroke solid and part of the base image hidden:
If the stroke is applied via the stroke option for vector layers, this still works. However, in that case set the Vector Fill to none and leave the Fill Opacity for the stroke layer at 100%.