This question simply turns on the definition of the word "identity". Michael E2's answer is currently the best one, because he actually references a definition. Any college algebra or precalculus book that I can touch has such a definition, and every one that I see is effectively equivalent. In addition to Michael E2's examples, I can add:
Ratti & McWatters, Precalculus: A right triangle approach, 2E (Sec 1.1) :
An equation that is satisfied by every real number in the domain of
the variable is called an identity.
Sullivan, Algebra & Trigonometry, 7E (Sec 1.1) [1987-2005]:
An equation that is satisfied for every value of the variable for
which both sides are defined is called an identity.
Rietz & Crathorne, Introductory College Algebra, Revised (Ch. II, Art. 18) [1923-1933]:
The two members of an identity are equal for all values of the symbols
for which the expressions are defined.
I include dates and the latter example to highlight that the customary definition of an "identity" has been stable and consistent for at least the last century.
The OP should refer the student to the definition in use in the course's textbook and/or lecture notes (which hopefully matches all of the preceding examples). In particular, an identity only needs values to match when both sides are defined; so it is not foiled by looking at values outside the domain of the expressions. This answers the student's question.
For a similar example that one should be preparing students to look very carefully at their definitions, consider the fact that the definition of a continuous function similarly looks only at points in the domain (so that, e.g., $1/x$ qualifies as a continuous function).