Let $\mathbb x=(X_1,...,X_j,...,X_k)$ by a $k-$dimensional random vector, i.e. a fixed-position collection of random variables (measurable real functions).
Consider many such vectors, say $n$, and index these vectors by $i=1,...,n$, so, say
$$\mathbb x_i=(X_{1i},...,X_{ji},...,X_{ki})$$ and regard them as a collection called "the sample", $S=(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$. Then we call each $k-$ dimensional vector an "observation" (although it really becomes one only once we measure and record the realizations of the random variables involved ).
Let's first treat the case where either a probability mass function (PMF) or a probability density function (PDF) exists, and also, joint such functions. Denote by $f_i(\mathbb x_i),\;i=1,...,n$ the joint PMF or joint PDF of each random vector, and $f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$ the joint PMF or joint PDF of all these vectors together.
Then, the sample $S$ is called an "independent sample", if the following mathematical equality holds:
$$f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) = \prod_{i=1}^{n}f_i(\mathbb x_i),\;\;\; \forall (\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) \in D_S$$
where $D_S$ is the joint domain created by the $n$ random vectors/observations.
This means that the "observations" are "jointly independent", (in the statistical sense, or "independent in probability" as was the old saying that is still seen today sometimes). The habit is to simply call them "independent observations".
Note that the statistical independence property here is over the index $i$, i.e. between observations. It is unrelated to what are the probabilistic/statistical relations between the random variables in each observation (in the general case we treat here where each observation is multidimensional).
Note also that in cases where we have continuous random variables with no densities, the above can be expressed in terms of the distribution functions.
This is what "independent observations" means. It is a precisely defined property expressed in mathematical terms. Let's see some of what it implies.
SOME CONSEQUENCES OF HAVING INDEPENDENT OBSERVATIONS
A. If two observations are part of a group of jointly independent observations, then they are also "pair-wise independent" (statistically),
$$f(\mathbb x_i,\mathbb x_m) = f_i(\mathbb x_i)f_m(\mathbb x_m)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$
This in turn implies that conditional PMF's/PDFs equal the "marginal" ones
$$f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$
This generalizes to many arguments, conditioned or conditioning, say
$$f(\mathbb x_i , \mathbb x_{\ell}\mid \mathbb x_m) = f(\mathbb x_i , \mathbb x_{\ell}),\;\;\;\; f(\mathbb x_i \mid \mathbb x_m, \mathbb x_{\ell}) = f_i(\mathbb x_i)$$
etc, as long as the indexes to the left are different to the indexes on the right of the vertical line.
This implies that if we actually observe one observation, the probabilities characterizing any other observation of the sample do not change. So as regards prediction, an independent sample is not our best friend. We would prefer to have dependence so that each observation could help us say something more about any other observation.
B. On the other hand, an independent sample has maximum informational content. Every observation, being independent, carries information that cannot be inferred, wholly or partly, by any other observation in the sample. So the sum total is maximum, compared to any comparable sample where there exists some statistical dependence between some of the observations. But of what use is this information, if it cannot help us improve our predictions?
Well, this is indirect information about the probabilities that characterize the random variables in the sample. The more these observations have common characteristics (common probability distribution in our case), the more we are in a better position to uncover them, if our sample is independent.
In other words if the sample is independent and "identically distributed", meaning
$$f_i(\mathbb x_i) = f_m(\mathbb x_m) = f(\mathbb x),\;\;\; i\neq m$$
it is the best possible sample in order to obtain information about not only the common joint probability distribution $f(\mathbb x)$, but also for the marginal distributions of the random variables that comprise each observation, say $f_j(x_{ji})$.
So even though $f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)$, so zero additional predictive power as regards the actual realization of $\mathbb x_i$, with an independent and identically distributed sample, we are in the best position to uncover the functions $f_i$ (or some of its properties), i.e. the marginal distributions.
Therefore, as regards estimation (which is sometimes used as a catch-all term, but here it should be kept distinct from the concept of prediction), an independent sample is our "best friend", if it is combined with the "identically distributed" property.
C. It also follows that an independent sample of observations where each is characterized by a totally different probability distribution, with no common characteristics whatsoever, is as worthless a collection of information as one can get (of course every piece of information on its own is worthy, the issue here is that taken together these cannot be combined to offer anything useful). Imagine a sample containing three observations: one containing (quantitative characteristics of) fruits from South America, another containing mountains of Europe, and a third containing clothes from Asia. Pretty interesting information pieces all three of them -but together as a sample cannot do anything statistically useful for us.
Put in another way, a necessary and sufficient condition for an independent sample to be useful, is that the observations have some statistical characteristics in common. This is why, in Statistics, the word "sample" is not synonymous to "collection of information" in general, but to "collection of information on entities that have some common characteristics".
APPLICATION TO THE OP'S DATA EXAMPLE
Responding to a request from user @gung, let's examine the OP's example in light of the above.
We reasonably assume that we are in a school with more than two teachers and more than six pupils. So
a) we are sampling both pupilss and teachers, and
b) we include in our data set the grade that corresponds to each teacher-pupil combination.
Namely, the grades are not "sampled", they are a consequence of the sampling we did on teachers and pupils. Therefore it is reasonable to treat the random variable $G$ (=grade) as the "dependent variable", while pupils ($P$) and teachers $T$ are "explanatory variables" (not all possible explanatory variables, just some). Our sample consists of six observations which we write explicitly, $S = (\mathbb s_1, ..., \mathbb s_6)$ as
\begin{align}
\mathbb s_1 =(T_1, P_1, G_1) \\
\mathbb s_2 =(T_1, P_2, G_2) \\
\mathbb s_3 =(T_1, P_3, G_3) \\
\mathbb s_3 =(T_2, P_4, G_4) \\
\mathbb s_4 =(T_2, P_5, G_5) \\
\mathbb s_5 =(T_2, P_6, G_6) \\
\end{align}
Under the stated assumption "pupils do not influence each other", we can consider the $P_i$ variables as independently distributed.
Under a non-stated assumption that "all other factors" that may influence the Grade are independent of each other, we can also consider the $G_i$ variables to be independent of each other.
Finally under a non-stated assumption that teachers do not influence each other, we can consider the variables $T_1, T_2$ as statistically independent between them.
But irrespective of what causal/structural assumption we will make regarding the relation between teachers and pupils, the fact remains that observations $\mathbb s_1, \mathbb s_2, \mathbb s_3$ contain the same random variable ($T_1$), while observations $\mathbb s_4, \mathbb s_5, \mathbb s_6$ also contains the same random variable ($T_2$).
Note carefully the distinction between "the same random variable" and "two distinct random variables that have identical distributions".
So even if we assume that "teachers do NOT influence pupils", then still, our sample as defined above is not an independent sample, because $\mathbb s_1, \mathbb s_2, \mathbb s_3$ are statistically dependent through $T_1$, while $\mathbb s_4, \mathbb s_5, \mathbb s_6$ are statistically dependent through $T_2$.
Assume now that we exclude the random variable "teacher" from our sample. Is the (Pupil, Grade) sample of six observations, an independent sample?
Here, the assumptions we will make regarding what is the structural relationship between teachers, pupils, and grades does matter.
First, do teachers directly affect the random variable "Grade", through perhaps, different "grading attitudes/styles"? For example $T_1$ may be a "tough grader" while $T_2$ may be not. In such a case "not seeing" the variable "Teacher" does not make the sample independent, because it is now the $G_1, G_2, G_3$ that are dependent, due to a common source of influence, $T_1$ (and analogously for the other three).
But say that teachers are identical in that respect. Then under the stated assumption "teachers influence students" we have again that the first three observations are dependent with each other, because teachers influence pupils who influence grades, and we arrive at the same result, albeit indirectly in this case (and likewise for the other three). So again, the sample is not independent.
THE CASE OF GENDER
Now, let's make the (Pupil, Grade) six-observation sample "conditionally independent with respect to teacher" (see other answers) by assuming that all six pupils have in reality the same teacher. But in addition let's include in the sample the random variable "$Ge$=Gender" that traditionally takes two values ($M,F$), while recently has started to take more. Our once again three-dimensional six-observation sample is now
\begin{align}
\mathbb s_1 =(Ge_1, P_1, G_1) \\
\mathbb s_2 =(Ge_2, P_2, G_2) \\
\mathbb s_3 =(Ge_3, P_3, G_3) \\
\mathbb s_3 =(Ge_4, P_4, G_4) \\
\mathbb s_4 =(Ge_5, P_5, G_5) \\
\mathbb s_5 =(Ge_6, P_6, G_6) \\
\end{align}
Note carefully that what we included in the description of the sample as regards Gender, is not the actual value that it takes for each pupil, but the random variable "Gender". Look back at the beginning of this very long answer: the Sample is not defined as a collection of numbers (or fixed numerical or not values in general), but as a collection of random variables (i.e. of functions).
Now, does the gender of one pupil influences (structurally or statistically) the gender of the another pupil? We could reasonably argue that it doesn't. So from that respect, the $Ge_i$ variables are independent. Does the gender of pupil $1$, $Ge_1$, affects in some other way directly some other pupil ($P_2, P_3,...$)? Hmm, there are battling educational theories if I recall on the matter. So if we assume that it does not, then off it goes another possible source of dependence between observations. Finally, does the gender of a pupil influence directly the grades of another pupil? if we argue that it doesn't, we obtain an independent sample (conditional on all pupils having the same teacher).
teacher
bygender
? Gender is present in most social science data and correlates with almost anything to some extent. $\endgroup$