If you have a song with accidentals and you sing it, are you then singing off key? And if you are in the key of C major for example, and in the song a D is raised to a D# with an accidental and instead of the D# you sing a D. Does that mean that you are singing off key?
'Off key' often means 'out of tune', so if the singer is singing an accidental properly, they may well be 'in tune', but 'out of key'. The accidental D# isn't diatonic (meaning a note from the key) so it could be thought of as 'off key', but a more apposite term would be 'out of the key'.
Accidentals are used for all kinds of reasons. A D# in the key of C, alongside a B and an F#, would make a V/iii chord, for example, which is a perfectly legitimate chord in the key of C.
Or it could indicate a temporary modulation—a change of key—to E major or B major, or e minor for that matter. In that case, D# is "in key," despite what the key signature says.
Point is, accidentals aren't actually "outside the key" at all. They just indicate that something interesting is happening harmonically.
Does that mean that you are singing off key?
Your question is not quite comprehensible as stated:
As far as the singer goes, whether it's
on key or
off key is irrelevant. If the music says
D# and you sing
D , you are singing the wrong note: It's not the note the composer wanted you to sing, regardless of whether or not it's
Are you simply asking about semantics? Terminology? Regardless,
Off Key is not a technical term, so it's difficult to have such a discussion.
The first question to ask here boils down to your title, which I'd translate as Is
D# diatonic to C Major? - meaning is it one of the notes of the C major scale. But the answer to that question simple: D# clearly is not diatonic to C Major - it's an accidental - a note outside the parameters of the key/key signature in question. You knew that before you asked the question - that's why you asked it.
So the real question is this: Since D# is not part of the C major scale, why is D# found in a piece of music that has the key signature of C Major? What functions might D# serve in the key of C Major? Is it right or wrong, is it
in key or
off key aren't particularly relevant to anything - that's how the music is written, and so we need to deal with it. What interests us as musicians or musical theoreticians is how would D# function in C Major - we need to understand the music we are dealing with.
To get a definitive answer to that question, we'd have to see the whole sheet, or ask the composer.
Offhand the simple explanation is that D# is serving as a chromatic passing tone between D and E. Such chromatic (non-diatonic) passing tones are extremely common - it's fair to say they're ubiquitous in virtually all genres - they add color, depth and smoothness to music.
@JohnMGant in his answer gave some other good reasons for why we might encounter D# in music with a key signature of C Major.
Every accidental indicates a modulation, or a feint towards one, otherwise, they'd be in the key signature. No one would consider a modulation "off key" or "out of the key" because it's intentional, and those refer to mistakes. In common practice tonality, almost always, if you see a sharp, it's the 7 of the key you're moving to; flats are the 4 of the key you're moving to, just as the last sharp in the key signature is the 7 of the key, the last flat is the 4 of the key.