The window or a window?
Solution 1:
The difference between the two sentences really comes down to context.
If there have been no preceding sentences, and there are no following sentences, then the meaning is essentially the same.
But if there is other information conveyed by another sentence, then there can be a significant difference between the use of the definite article and the indefinite article in the single sentence.
The definite article
The use of the definite article calls out something specific.
Normally, the specificity of the thing is explicit:
I hit the red ball.
The inference is that there is more than one ball, and only one of them is red.
But, sometimes, the specificity doesn't need to be explicit.
For instance, a book can start off with the use of the definite article in the following way:
The man was walking down the street.
But which man was it? The man walking down the street.
But what if there were several men walking down the street? It's the man being discussed by the narrative of the story.
This man is only just being introduced, and will be discussed in greater length in the sentences that follow.
In short, the context of specificity need not be not limited to a single sentence, but can apply to the entire paragraph, chapter, or book.
If only that single sentence were given, it would be strange. But, often, it's not the only sentence given about the subject. The resolution of specificity is suspended until later on:
The man was walking down the street. He was tall, wore a hat, and walked with a limp.
The second sentence follows up and gives the specificity that had been lacking in the first sentence. It was that man, as opposed to any others that might have been walking down the street with him.
The same is true of the ball with the window:
My ball hit the window of our principal's office.
But which window was it? The window that my ball hit.
But what if there were several windows?
As in the other example, the resolution of specificity can be resolved in a following sentence:
My ball hit the window of our principal's office. It was the same window that had been broken last week.
There is a slight let down of expectation if the window is not narrowed down further in a subsequent sentence, because we normally expect there to be something more. However, even if that's not the case, we can still picture some window in general being hit.
If there is no further resolution of specificity, and the only mention of the window is in the single sentence, and it's been made clear that the principal's office has more than one window, then it's more normal to phrase it differently:
My ball hit one of the windows of our principal's office.
Note that if nothing has ever been said about how many windows there are, and no further mention is made in later sentences about this, then the use of the definite article without any qualification will have the reader infer there only is a single window.
The indefinite article
My ball hit a window of our principal's office.
Without any further qualification, this says exactly the same thing as the following:
My ball hit one of the windows of our principal's office.
The indefinite article on its own just says that there is more than one window. Which of the several windows was hit need not be explained, although it often is.
Whether you use a or one of the is a matter of style and personal preference. In this particular sentence, it's likely that one of the is more common, but that doesn't mean that a is actually wrong.
Note that the same book as before could also start in this way:
A man was walking down the street. He was tall, wore a hat, and walked with a limp.
What's the difference? With the use of the definite article, there's a very subtle nuance that you're calling out a particular man from the first sentence.
But with the indefinite article, even though you later talk about a particular man, it starts off as if it's referring to a man of no particular importance. It only becomes clear that the man has a particular importance in the second sentence.
It's probably more common to use the indefinite article in this case. But there is certainly a writing style that deliberately uses the definite article in order to put additional emphasis on the special nature of the subject from the start.