I am a British national who is resident in the UK. My wife is Chinese and we are now on holiday in England (we spend a lot of time in China). She is on a tourist visa for the UK. We want to go to Spain, but everybody is telling us she has to apply for a Schengen visa in China. IS there any way for us to obtain a Schengen visa from within the UK for her?
You may be able to apply in the UK, but, as Gayot Fow says in a comment, you will likely have to make a case for an exception. From the Schengen Visa Code, article 6:
Consular territorial competence
An application shall be examined and decided on by the consulate of the competent Member State in whose jurisdiction the applicant legally resides.
A consulate of the competent Member State shall examine and decide on an application lodged by a third-country national legally present but not residing in its jurisdiction, if the applicant has provided justification for lodging the application at that consulate.
That's not particularly informative, but you can look at the Handbook for the processing of visa applications and the modification of issued visas, section 2.8, for more guidance. The examples there imply that "sufficient justification" can be related to the following circumstances:
The traveler will not be close enough to travel to the appropriate consulate during the three months before the trip (because it is not possible to apply for a Schengen visa more than three months before the start of the intended visit).
The traveler's plans change while the traveler is away from home, and requiring the traveler to return home to apply for a visa would be "excessive."
If your plans have changed just because you decided it would be a nice idea to go to Spain, however, that's less likely to be sufficient. The example given in the handbook is of a Chinese woman who is working temporarily in the UK when her father, who lives in France, dies. That is obviously a more compelling justification than a change in vacation plans would be.
As Gayot Fow also notes, however, you may be able to benefit from European Union freedom of movement rules. The handbook's Part III concerns "specific rules relating to applicants who are family members of EU citizens...." In particular, in your case:
No visa fee can be charged.
As family members should not pay any fee when submitting the application, they cannot be obliged to obtain an appointment via a premium call line or via an external provider whose services are charged to the applicant. Family members must be allowed to lodge their application directly at the consulate without any costs. However, if family members decide not to make use of their right to lodge their application directly at the consulate but to use the extra services, they should pay for these services.
3.3. Granting every facility
Member States shall grant third country family members of EU citizens falling under the Directive every facility to obtain the necessary visa. This notion must be interpreted as ensuring that Member States take all appropriate measures to ensure fulfilment of the obligations arising out of the right of free movement and afford to such visa applicants the best conditions to obtain the entry visa.
I would take "every facility to obtain the necessary visa" to mean that any consulate should accept the application without the need for your wife to provide "justification," but I don't know whether the Spanish government would interpret it that way.
Finally, if you are unable to get a visa from the Spanish consulate, you can try entering the Schengen area by train or ferry, because of the following provision:
When a family member of an EU citizen, accompanying or joining the EU citizen in question, and who is a national of a third country subject to the visa obligation, arrives at the border without holding the necessary visa, the Member State concerned must, before turning him back, give the person concerned every reasonable opportunity to obtain the necessary documents or have them brought to him within a reasonable period of time to corroborate or prove by other means that he is covered by the right of free movement. If he succeeds in doing so and if there is no evidence that he poses a risk to the public policy, public security or public health requirements, the visa must be issued to him without delay at the border, while taking account of the guidelines above.
(In fact, you could also try air travel, but if I were you I would be reluctant to risk being denied boarding by an airline.)
I would advise you and your wife to approach a Spanish consulate in the UK and ask them for a visa for your wife.