In a relation schema, if:
But what happens when there are attributes in the middle? Are they prime if they are a subset of the key?
Start from scratch with what you think a prime attribute is, because your definition is incomplete.
For an attribute to be prime, is has to be part of a candidate key. Now, in your case, it happens that A is prime and the rest are not (Since the only candidate key is A). But take this scenario: F={ {A->C}, {B->C}, {C->D}, {D->AB} }. In this case, there are two candidate keys: AB, and D.
This means that A, B, and D are all prime, since they are all parts of candidate keys, and C is not.