How to omit particular points of given value in surface plot?

Suppose I would like to draw some surface plot of function which includes singularities and therefore values in infinity (for example 1/(x²+y²)). This topic was already discussed on TeX SE (see). Here is MWE:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,restrict z to domain*=0:10]
domain=-2:2,miter limit=1] {1 / (x^2 + y^2)};
\end{axis}
\end{tikzpicture}
\end{document}


Now, if I already have good looking shape near singularities (increased number of samples to 71):

on top of these points, there is a plane which I would like to remove and make it looks hollow (like on the picture bellow)

Since I didn't find any answer to this, I was thinking about using if in this manner:

IF (function value != value of mentioned plane)


Hint: I tried IF THEN from tikz math library, but I ended in errors. But this can work I guess.

Q: Is possible to make similar code in LaTeX?

Is there more simple way to remove top plane?

Edit According to cfr suggestions, I did some corrections and MWE is provided.

• It is better to include an example here, even if it is duplicating the one linked (of course with an attribution and link to the original) so that your question remains meaningful even if the linked one changes or gets deleted. – cfr Sep 10 '17 at 12:28
• tex.stackexchange.com/questions/333552/… You want this but with a hole instead of a cap? But wouldn't the inside surfaces, so to speak, show in the hole, so the hole won't be seen, even if you don't have the cap? – cfr Sep 10 '17 at 12:30
• Ok, I did some corrections and illustrative images are included. Hope it is clear now – struct Sep 10 '17 at 12:50
• That's much clearer now, thanks. I don't know the answer - but at least I understand the question :). – cfr Sep 10 '17 at 13:03

The color data which is used to choose the segment color can be used to hide individual segments. To this end, you have to assign an unbounded color data (like "not a number"):

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,restrict z to domain*=0:10]

The value point meta defines the color data, and all within the circle of radius 0.23 are invisible in my example.