A courteous apology in a busy market
When you knock against a stall or interrupt a conversation to ask a question, disculpe can help acknowledge the intrusion. It is the form associated with usted. If you already address someone as tú, disculpa is the corresponding familiar option. The noun perdón avoids choosing between the two. A short apology followed by a clear request is generally more useful than a long explanation when other people are waiting.
Explaining an accidental mistake
If you have knocked over a drink, saying that it was unintentional may help explain what happened. No fue mi intención means that you did not intend to do it. However, the explanation is not a substitute for an apology. If you can help clean up or replace something, offering to do so makes the exchange more constructive. Fue mi culpa is another option when the mistake was clearly yours.
A more deliberate apology at a hotel
A reservation mix-up can require more than a quick perdón, especially if you have given the wrong information. Le pido disculpas is a useful courteous formulation when addressing someone as usted. Follow it with the specific issue rather than leaving the other person to guess. In a message, the same wording works when you want to acknowledge an inconvenience and explain how you intend to resolve it.