Yes.  Set variable `isearch-filter-predicate` to a function that returns `nil` for the text that you want to ignore for search and query-replace.

(Set it back to its default value of `isearch-filter-visible` when you're done.  Alternatively, define your own search or query-replace function that binds the variable and then invokes regular Isearch or query-replace.)

For example, you can put a text property `my-ignore` on some text, giving it a non-`nil` value.  Then this function returns `nil` for what would normally be search hits on such text, so they are ignored for search and query-replace:


<!-- language: lang-el -->

    (defun skip-if-my-ignore (beg end)
      "Return nil iff some text BEG to END has non-`nil' property `my-ignore'."
      (catch 'skip-if-my-ignore
        (let ((pos  beg))
          (while (< pos end)
            (when (get-text-property pos 'my-ignore) (throw 'skip-if-my-ignore nil))
            (setq pos  (1+ pos))))
        t))

    ;; Make Isearch and query-replace ignore text with non-`nil' property `my-ignore'.
    (setq isearch-filter-predicate  'skip-if-my-ignore)