0 is a valid value for many data types, so that wouldn't work.
Wherever you have a nullable Datum in PostgreSQL server code, you also have a bool flag (typically called isnull) that indicates if the Datum is NULL or not.
Compare the following definition from src/include/postgres.h:
/*
* A NullableDatum is used in places where both a Datum and its nullness needs
* to be stored. This can be more efficient than storing datums and nullness
* in separate arrays, due to better spatial locality, even if more space may
* be wasted due to padding.
*/
typedef struct NullableDatum
{
#define FIELDNO_NULLABLE_DATUM_DATUM 0
Datum value;
#define FIELDNO_NULLABLE_DATUM_ISNULL 1
bool isnull;
/* due to alignment padding this could be used for flags for free */
} NullableDatum;