Here's why:
* "Library" is a noun. It refers to a place.
* "Studying" is a verb. It describes an action.
You need a preposition to connect the verb "studying" to the noun "library."
Here are some correct ways to phrase the sentence:
* You were studying at the library this morning.
* You were in the library studying this morning.
* You were studying in the library this morning.