You trying to call
within on a string representing a layer, not its geometry. But it won't work that way anyway. This way it would label/not label whole feature, not segments. With
within it would label feature with
" " in case that whole line is in polygon. In case of
intersects it will label feature that somehow interact with any polygon.
Maybe there is option how to solve this with expression of
Label with, but I thing this is primary for formatting label text for feature, not for label placement. I didn't figure out how to split the line geometry in this expression for the desired result.
In QGIS 3.8, there is
Geometry generator in Placement tab in labels properties. With this you can generate new source geometry only for labels, in your case lines that are not intersecting polygons. Labels are than rendered only over this geometry (i.e. rendering labels over polygon i suppressed):
buffer function, this gives space around polygon to suppress label rendering. This avoids long labels overlap polygons.
Than in Rendering tab check the
Label every part of multi-part features. This keeps rendering labels on all part of a line (lines that overlap the polygon and continues).