Does "John" c-command "himself" in this sentence? "Mary talked to John about himself."
Traditionally, c-command does not reach out of a prepositional phrase. Here are two definitions of c-command taken from the literature:
C-command: A node A c-commands a node B if, and only if A's sister either is B or contains B (Adger 2003: 117)
C-command: Node X c-commands node Y if a sister of X dominates Y. (Sportiche et al. 2014: 161)
Both of these definitions are such that a nominal does not c-command out of a prepositional phrase. Thus, John does not c-command himself in the sentence from the question because the only sister of the DP/NP John is the preposition P to. Crucially, the preposition P about is NOT a sister of the DP/NP John.
There is a second problem for c-command in the example sentence from the question. One could (and some likely have) produce(d) a definition that has c-command ignoring prepositions and thus reaching out of prepositional phrases. But if one does this, then there is another problem, the one of strict binarity of branching. Many modern phrase structure grammars assume all branching to be strictly binary. The difficulty for c-command in the example sentence in this regard is that one could well opt for a left branching structure in the VP, which means that the PP to John would not c-command the PP about himself because it could not reach out of the V' talked to John. This point is illustrated in the next (simplified) phrase structure diagram:
On this structural analysis, the DP/NP John is doubly unable to c-command the DP/NP himself, for the sister node of the PP to John is the V node of talked, not the V' node.
There are various ways to overcome this second problem. One way is to eject the requirement that all branching be strictly binary, allowing n-ary branching instead. A ternary branching analysis does not have this problem, e.g.
The PP to John now c-commands the PP about himself. There is, though, now another problem, since the PP about himself also c-commands the PP to John. This structure therefore does not get it right because it incorrectly predicts that * Mary talked to himself about John should also be acceptable, for the two PPs should mutually c-command each other.
Another potential solution to the second problem is to assume a VP-shell analysis, one along the following lines:
The details in this tree are not so important. What is important is that on this analysis, the PP to John now c-commands the PP about himself such that the second problem is overcome. There is another problem that now arises, though, one that is often overlooked. This other problem is that the VP-shell analysis ends up viewing strings such as to John about himself as constituents (VP1 in the tree). There is little independent evidence that supports this analysis of such strings. Most tests for constituents suggest that the string to John about himself is NOT a constituent.
In sum, the example sentence in the question and the question itself represent a big problem for c-command and the traditional binding theory. For reasons like this, many syntacticians (like me) reject the c-command approach to binding, opting instead for an approach that sees linear order and a basic hierarchy of grammatical relations as playing central roles in the theory of binding relations.
It depends on three things, (i) your understanding of Condition A, (ii) your definition of c-command, and (iii) how you analyze the structure of PP.
In the traditional binding theory, the distribution of reflexive pronouns like himself is constrained by Condition A, which states that reflexives must be (locally) bound by their antecedents. This means they have to be c-commanded by and co-referential with their antecedents (in some specified "local" domain). If we adopt the view that c-command indeed plays a role in the distribution of reflexives, then it must be the case that John c-commands himself here. However, the traditional, simplified definition of c-command, together with traditional assumptions about the structure of PP, make it unclear how this could be possible. This problem is made very clear in Tim Osborne's answer.
There are basically three responses to this observation. One is to revise Condition A: instead of depending on c-command, it depends on something else. You can find this approach in Benjamin Bruening's paper 'Precede and command revisited' published in Language, 2014. Bruening proposes replacement of c-command in this domain with a version of "precede and command."
Another option is to adopt a more complex definition of c-command. Many people would say that sentences like the one you're asking about demonstrate that c-command "out of PP" is possible, and so we should have some definition of c-command that allows this. This is a common strategy.
The other possibility is to look more closely at the structure of PP. For example, David Pesetsky advocates in his book Zero Syntax that PPs form a "cascade" structure, according to which c-command would actually hold in the example you give. The structure would be something like this:
Mary talked [PP1 [P1 to] [PP2 John [P'2 [P2 about] himself]]]
You could also assume that "reanalysis" is possible, such that a preposition can become incorporated with the verb, turning the object of the preposition into the direct object of the sentence. With this approach, you would have a structure something like this, where John again c-commands himself. (Notice there's a VP shell here).
Mary [VP1 [V1 talked to] [VP2 John [V'2 V2 [about himself]]]]
And there are other proposals dealing with the structure of PP which would assume John does c-command himself, even with the simplified definition of c-command.
In summary then, there are the answer to the question is no only if we assume PPs block c-command, and we adopt a certain structure for PP. This is a problem if we assume the traditional Condition A stated in terms of c-command, and not if we understand Condition A in some other way.