For example, while having lunch with your coworkers and you have to attend some matter soon, what would be a natural way to leave the table? I think that in this case saying お先に失礼します would be wrong.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I won't say お先に失礼します is completely out of place, but you should at least mention why you're leaving, so as to assure that you're not offended or anything:
Abruptly announcing お先に失礼します is probably too closely tied to the idiomatic usage (when leaving work).
先に戻ります or 先に行きます can also work as a substitution for 先に失礼します.
If you're unsure about which verb to use, just cut it short with a trailing ellipsis (see Axioplase's and Dave's answer):
If your colleagues already know you have something to attend to, or your KY radar is all clear, you can get as brief as:
Some people may think it's too informal for work, but you'll be ok as long as other people around you are using it.
ごちそうさまでした works best when you're eating your bentos together. See Dave's answer for a complete explanation.
I usually say something like "あ、すみません、あのう…少し用事があるのですが…". When I get visual acknowledgement, I stand up, bow and go away saying, "あ、では、失礼します。"
お先に失礼します is appropriate. You can drop the お if there's something before 先に失礼します:
-(今日は仕事が忙しいので or any other reason)先に失礼します
-Or you have the obvious ごちそうさまでした
In any case, both sentences are a little abrupt. Saying 皆さんゆっくり食べて（ください）ね works well.
ごちそうさま[でした] is the closest you could get to a meal-closing expression. It can be "dangerous", in that it has the implied sense of being treated by whoever you are saying this to (and would therefore be extraordinarily rude, if that is not the case, like saying "thanks for inviting me" when the bill comes, and you were not invited). However, it is perfectly fine in a casual context where it is clear nobody's treating anybody else, such as a work cafeteria lunch.
In your particular case, perhaps a simple short excuse ("会議がありますので...") while getting up might do.
It is also very common (particularly for younger people and women) to do a very small bow-with-praying-hands at the end of a meal (usually while saying ごちそうさま[でした]), similar to the way you open with (bow-with-hands-together, saying "いただきます"): this is the way children are taught to behave at a table, but I think it's still perfectly OK as an adult (albeit played down a little not to sound too childish) and does send the message you are getting up from the table.