There are several reasons a particular pixel in a specific image might not be useful:
from the pixel.
the other pixels do.
The following notebooks walk through identifying each of those types of bad pixels and how to create a mask for them.