Under what conditions can a "good" or "charitable" act actually be sin? In spite of a prevalent cultural attitude towards sin that excuses misbehavior if a person had "good intentions", most Christian traditions do not seem to include the persons feelings in the matter when defining an action as sin or not. However the converse does not seem to be as frequently addressed. Are there Christian traditions that have specific teachings about a "good" action being still sinful under some conditions? If so, what are do these teachings consider the basis of sin and how would a worldly good dead not meet those conditions?

Lets use an example:

Where I live street beggars are common place. Just as common place is the act of fishing in ones pocket for a coin or two to leave with them. Where in any Christian traditions teaching would this be dealt with as a potential sin trap? How would these teachings define sin in such a way that even an act of deliberate charity could be considered sinful?

Note: For the purpose of this question we can rule out what the beggar chooses to do with the money. This isn't about unintended consequences of that action down the road. Likewise I would eliminate "sins of omission" from the discussion in so far as this isn't about what else I could have done with the money or what more good I could have done and didn't.
The Catholic position holds that for grave (mortal) sins, one must be fully aware of the sinful act and commit it with full intention of doing so. If you have not, then you aren't culpable. Venial (minor) sins, looking at the catechism, doesn't appear to be as clearly specified so I think it's reasonable to assume that these may be committed inadvertently. However, while social ramifications may occur despite your intentions and knowledge, they aren't necessarily incredibly serious offenses either. As mentioned in the Catechism:

1873 The root of all sins lies in man's heart. The kinds and the gravity of sins are determined principally by their objects.

So, if one commits an action that would be sinful, but has not sinned in one's heart (if it was unintentional or accidental through no fault of your own) then you are not culpable for the sin. Conversely, if one performs a good deed yet does so for reasons that are amoral, the person would have sinned.

An example of this would be Jesus' rebuke of the Pharisees. They acted according to the letter of the Law because they were commanded to uphold it. However, in their hearts, they harbored pride and greed, among other sinful thoughts. In Matthew 23:27-28, Jesus describes this with a metaphor:

27 Woe to you, scribes and Pharisees, hypocrites; because you are like to whited sepulchres, which outwardly appear to men beautiful but within are full of dead men's bones and of all filthiness. 28 So you also outwardly indeed appear to men just: but inwardly you are full of hypocrisy and iniquity.

Jesus also states earlier in this chapter, in verse 23:

23 Woe to you, scribes and Pharisees, hypocrites; because you tithe mint and anise and cumin and have left the weightier things of the law: judgment and mercy and faith. These things you ought to have done and not to leave those undone.

Here this shows that they have sinned in their attitudes, but even so, their works were good. So what Jesus is calling them to do is to reform their hearts, but continue to do good works as they have been.