When we're careful and technical about what a function is, the domain is a known property of a function, not something we deduce from the function. So we can have $f(x) = x^2$ defined for rational $x$, or for positive real $x$, or when $x$ is the square of a prime number. These are all different functions with the same formula $x^2$ describing them.
However, we often use a function's "implicit domain", where a function is described by a formula, but nothing actually says what its domain is. The implicit domain is the set of numbers where evaluating the formula won't result in "undefined" operations like dividing by zero, taking the square root or logarithm of a negative number, etc. This is a subset of some other implied set of numbers, usually either the real numbers or the complex numbers. (It could be some other set of inputs, if the context for the function definition makes that clear enough. In those cases it's usually better writing to name the domain, though.)
So suppose we have a function described as
$$ f(x) = \frac{2x+8}{\frac{1}{x-3}+\frac{1}{x^2-9}} $$
with no domain mentioned. In the context of your class or book, we can probably assume we're working with real numbers. We have division by zero if $x-3=0 \Rightarrow x=3$, or $x^2-9=0 \Rightarrow x=\pm 3$, or $\frac{1}{x-3}+\frac{1}{x^2-9} = 0 \Rightarrow x=-4$. So the implicit domain is the set of all the real numbers except $-4$, $-3$, and $3$. This set can be written in various ways, including $\mathbb{R} \setminus \{-4,-3,3\}$.
Then we can do some manipulations and find
$$ f(x) = \frac{2x^3+8x^2-18x-72}{x+4} $$
If this were the first thing we saw, its domain might be the implicit domain $\mathbb{R} \setminus \{-4\}$. But we already know what $f$ is, and we've already decided that its domain is $\mathbb{R} \setminus \{-4,-3,3\}$. And the equation above is a true statement for every $x$ in the domain of $f$. Yes, the formula on the right also has values when $x=\pm 3$, but the function $f$ doesn't, so there's nothing to compare or state at those points.
Now the limit in the actual problem changes things a bit more. As far as the limit operation $\lim_{x \to a}$ is concerned, the function involved only needs to be defined in some interval around the limit point, excluding that point itself. That is, there must be some small positive real number $\delta$ such that $f(x)$ is defined for every real $x$ satisfying $0 < |x-a| < \delta$. (Again I'm assuming a context of real numbers. Limits can be used in other metric spaces, but need a slightly different definition.) Then it doesn't matter if $f$ is defined for other values, or what those values of $f$ are. So in this case the domain is both not really specified and not that important. $\delta=1$ works, since $f$ is defined when $0 < |x-3| < 1$, or equivalently $2<x<4$ and $x \neq 3$, or equivalently $x$ is in the set $(2,3) \cup (3,4)$. This is true for both formulas describing $f$, no matter what domain they may have which includes that nearby set.
The formula simplification does result in a common nice way to prove a limit's value: With the two functions
$$ f(x) = \frac{2x+8}{\frac{1}{x-3}+\frac{1}{x^2-9}} $$
$$ g(x) = \frac{2x^3+8x^2-18x-72}{x+4} $$
defined in any domains which include the set $(2,3) \cup (3,4)$, and after showing that $f(x) = g(x)$ for every $x$ in that set, and showing that $g$ is continuous at $3$, then we must have
$$\lim_{x \to 3} f(x) = \lim_{x \to 3} g(x) = g(3)$$