How we use the /testfor command to detect if there's a block missing (or a new block) in an area with only one command block and comparator?
If you want to detect blocks, then /testforblocks is what you're looking for. /testfor is used to find entities, such as players, mobs or items. /testforblocks is used as follows:
testforblocks <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode]
from Minecraft Wiki:
x1 y1 z1and
x2 y2 z2:
Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). x1,
z2must all be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y1 and y2 must be between 0 and 255 (inclusive). May use tilde notation to specify coordinates relative to the command's position. The number of blocks in the source region must not exceed 524,288.
x y zSpecifies the lower northwestern corner (the corner with the most-negative values) of the region to be checked (the "destination region"). x and z must both be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y must be between 0 and 255 (inclusive). May use tilde notation to specify coordinates relative to the command's position. Source and destination regions may overlap.
Specifies how to match blocks. Must be one of:
all— every block in the source and destination regions must match exactly.
masked— air blocks in the source region will match any block in the destination region. If not specified, defaults to all.
To use testforblocks, you will need an area on your map to compare against - this will need to be in a loaded chunk, so I would put it underground and out of sight somewhere.