Quasi-optimal nonconforming methods for symmetric elliptic problems. I—abstract theory