Shoud a function be defined for all elements in the domain in order to be surjective/bijective?
You need every $x$ in the domain to have a $y$ in the codomain because it's a function, and that's the definition of a function. It had nothing to do with being injective or surjective.