I'm having a difficult time understanding exactly what you want to do, but hopefully the following will be helpful.
Say we have a datafile (test.dat):
NaN NaN NaN NaN NaN NaN NaN 100 200
NaN NaN NaN NaN NaN NaN 100 200 100
NaN NaN NaN NaN NaN 100 200 100 NaN
NaN NaN NaN NaN 100 200 100 NaN NaN
NaN NaN NaN 100 200 100 NaN NaN NaN
NaN NaN 100 200 100 NaN NaN NaN NaN
NaN 100 200 100 NaN NaN NaN NaN NaN
100 200 100 NaN NaN NaN NaN NaN NaN
200 100 NaN NaN NaN NaN NaN NaN NaN
We can plot this datafile using:
set datafile missing 'NaN'
set style data lines
splot 'test.dat' matrix #matrix allows our datafile to look like your first data grid
If I understand what you want correctly, you can't accomplish it without putting your data into a "grid" format (either using matrix or with "scan separators" (see below). dgrid3d won't work here since it doesn't know how to designate pieces of the data as missing. If you don't want to use matrix format, you can do:
#Note the blank spaces!
#Each block doesn't have to have the same number of lines
#but the resulting plot looks nicest if it does.
#for lines that you want to make blank, use some character to
#mark that data as missing. (I used 'NaN' above, but you can
#use anything you want. sometimes I use '?' too).
x1 y1 num
x1 y2 num
x1 y3 num
...
x2 y1 num
x2 y2 num
x2 y3 num
...
...
xN y1 num
xN y2 num
xN y3 num
...
As a concrete example: for your grid:
1 1 ?
1 2 ?
1 3 24
1 4 25
2 1 ?
2 2 23
2 3 24
2 4 25
3 1 23
3 2 23
3 3 24
3 4 ?
4 1 24
4 2 24
4 3 ?
4 4 ?
And then:
set datafile missing '?'
set style data lines
splot 'my_data.txt' #Not matrix this time.
Of course, with data at this resolution, the plot still may not look the way you want it, but hopefully that demonstrates the point.
EDIT
If you can get your datafile into the format that you show at the top of your post, you have a few (additional) options (without messing with the zeros):
set datafile missing '0' #This just has the effect of removing the 0 values from the plot
splot 'myfile.txt' matrix
Or:
set zrange [0.5:] #This also removes the 0 values, but alters the z-range.
splot 'myfile.txt' matrix