"The pasta is without milk."
I believe it's because "the pasta" in this sentence is the SUBJECT (i.e. it's the thing without milk) rather than a definite direct object. See also https://elon.io/learn-turkish/lesson/the-accusative-case-suffix.
So the accusative case doesn't apply.
They said that when we put (the) before the word we put (yi) to the Turkish word
That is not true in general - only if the word is a direct object!
For example, "the bread" in "I eat the bread" -- it is the direct object of "eat".
But "the bread tastes good" -- there "the bread" is not a direct object but a subject, so it does not get marked with the accusative case in Turkish.
Also, the accusative case marker is not always -yi -- it can be -i -ı -u -ü -yi -yı -yu -yü, depending on the last syllable of the word.